package org.circedroid.core;

public class PROJ{
	private int reg;
	private int prc;
	private int unite;
	private double lonMin;
	private double latMin;
	private double lonMax;
	private double latMax;
	public PROJ(int reg, int prc, int unite, double lonMin, double latMin, double lonMax, double latMax){
		this.reg=reg;
		this.prc=prc;
		this.unite=unite;
		this.lonMin=lonMin;
		this.lonMax=lonMax;
		this.latMin=latMin;
		this.latMax=latMax;
	}
	public int getREG(){return this.reg;}
	public int getPRC(){return this.prc;}
	public int getUnite(){return this.unite;}
	public double getLonMax(){
		double retour=0;
		double value=this.lonMax;
		switch (this.unite) {
		case 2:
			retour=value*Math.PI/180.0;
			break;
		case 3:
			retour=value*Math.PI/200.0;
			break;
		case 10:
			long deg;
			long min;
			double sec;
			deg=(long)value;
			min=(long)((value-(double)deg)*100.0);
			sec=((value-(double)deg)*100.0-(double)min)*100.0;
			if (sec>60){
				sec=0;
				min++;
			}
			retour=(double)deg+(double)min/60.0+sec/3600.0;
			retour=retour*Math.PI/180.0;
			break;
		}
		return retour;
	}
	public double getLatMax(){
		double retour=0;
		double value=this.latMax;
		switch (this.unite) {
		case 2:
			retour=value*Math.PI/180.0;
			break;
		case 3:
			retour=value*Math.PI/200.0;
			break;
		case 10:
			long deg;
			long min;
			double sec;
			deg=(long)value;
			min=(long)((value-(double)deg)*100.0);
			sec=((value-(double)deg)*100.0-(double)min)*100.0;
			if (sec>60){
				sec=0;
				min++;
			}
			retour=(double)deg+(double)min/60.0+sec/3600.0;
			retour=retour*Math.PI/180.0;
			break;
		}
		return retour;
	}
	public double getLonMin(){
		double retour=0;
		double value=this.lonMin;
		switch (this.unite) {
		case 2:
			retour=value*Math.PI/180.0;
			break;
		case 3:
			retour=value*Math.PI/200.0;
			break;
		case 10:
			long deg;
			long min;
			double sec;
			deg=(long)value;
			min=(long)((value-(double)deg)*100.0);
			sec=((value-(double)deg)*100.0-(double)min)*100.0;
			if (sec>60){
				sec=0;
				min++;
			}
			retour=(double)deg+(double)min/60.0+sec/3600.0;
			retour=retour*Math.PI/180.0;
			break;
		}
		return retour;
	}
	public double getLatMin(){
		double retour=0;
		double value=this.latMin;
		switch (this.unite) {
		case 2:
			retour=value*Math.PI/180.0;
			break;
		case 3:
			retour=value*Math.PI/200.0;
			break;
		case 10:
			long deg;
			long min;
			double sec;
			deg=(long)value;
			min=(long)((value-(double)deg)*100.0);
			sec=((value-(double)deg)*100.0-(double)min)*100.0;
			if (sec>60){
				sec=0;
				min++;
			}
			retour=(double)deg+(double)min/60.0+sec/3600.0;
			retour=retour*Math.PI/180.0;
			break;
		}
		return retour;
	}
}